package org.dk.service.impl;


import com.alibaba.dubbo.config.annotation.Service;
import org.dk.mapper.TbItemMapper;
import org.dk.pojo.TbItem;
import org.dk.pojo.TbItemExample;
import org.dk.service.ItemService;
import org.springframework.beans.factory.annotation.Autowired;

import java.util.List;

@Service
@org.springframework.stereotype.Service
public class ItemServiceImpl implements ItemService {

    @Autowired
    private TbItemMapper tbItemMapper;
    @Override
    public void addItem(List<TbItem> tbItems, Long goodId, String sellerId) {
        tbItemMapper.addItem(tbItems,goodId,sellerId);
    }

    @Override
    public List<TbItem> selectByGoodsId(Long id) {
        TbItemExample example = new TbItemExample();
        TbItemExample.Criteria criteria = example.createCriteria();
        criteria.andGoodsIdEqualTo(id);
        return tbItemMapper.selectByExample(example);
    }

    @Override
    public TbItem selectById(Long itemId) {
        return tbItemMapper.selectByPrimaryKey(itemId);
    }
}
